<?php
namespace Home\Controller;
use Think\Controller;
use Think\Page;

class ConferenceController extends CommonController {
  private $article_model;

  public function _initialize(){
    parent::_initialize();

    $this->article_model = M('Article');
  }


  public function index(){
    $this->common_conference(56,$template_parms);
  }

  public function small(){
    $template_parms = array(
      'action' => __FUNCTION__
      );

    $this->common_conference(45,$template_parms);
  }

  public function large(){
    $template_parms = array(
      'action' => __FUNCTION__
      );

    $this->common_conference(47,$template_parms);
  }

  public function media(){
    $template_parms = array(
      'action' => __FUNCTION__
      );

    $this->common_conference(46,$template_parms);
  }

  /*通用会议宴会
  * @$article_id: 文章id
  * @$template_parms: 模板参数
  *   is_title:是否显示标题
  */
  private function common_conference($article_id,$template_parms){
    $article = $this->article_model->find($article_id);
	$article = $this->check_EN_ZH($article);
    
	$photo = M('Photos');
	$photolist = $photo->where('is_small=1 and photoable_id='.$article_id)->order('created_at desc')->select();
  	foreach ($photolist as $k => $v ){
		$bigpath = $photo->where('id='.$v['parent_id'])->getField('path');
		$photolist[$k]['bigpath'] = $bigpath;
	}
	
	$this->assign('photo_list',$photolist);
	
    if(empty($template_parms['name']))
       $template_parms['name'] = 'index';

    $this->assign('article',$article);
    $this->assign('template_parms',$template_parms);
    $this->display("Conference/$template_parms[name]");
  }



}